/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf.views;

import com.openbrew.openbrewrf.TimeCard;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "Employee")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmployeeView.findAll", query = "SELECT e FROM EmployeeView e ORDER BY e.empLastName ASC"),
    @NamedQuery(name = "EmployeeView.getCurrentEmps", query = "SELECT e FROM EmployeeView e WHERE e.empAxed = 'false' ORDER BY e.empLastName ASC"),
    @NamedQuery(name = "EmployeeView.getBrewEmps", query = "SELECT e FROM EmployeeView e WHERE e.bBrewingAccess = 'true' ORDER BY e.empLastName ASC")})
public class EmployeeView implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "EmpID")
    private Integer empID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 30)
    @Column(name = "EmpLastName")
    private String empLastName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 30)
    @Column(name = "EmpFirstName")
    private String empFirstName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 30)
    @Column(name = "userName")
    private String userName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 30)
    @Column(name = "userPass")
    private String userPass;
    @Basic(optional = false)
    @NotNull
    @Column(name = "EmpAxed")
    private boolean empAxed;
    @Basic(optional = false)
    @NotNull
    @Column(name = "bBrewingAccess")
    private boolean bBrewingAccess;
    @OneToOne(mappedBy="employee")
    private TimeCard card;

    public EmployeeView() {
    }

    public EmployeeView(Integer empID) {
        this.empID = empID;
    }

    public EmployeeView(Integer empID, String empLastName, String empFirstName, String userName, String userPass, int userLevel, boolean empPOApproval, boolean empSysAdmin, String empEmail, String empEmailPass, boolean empAxed, String empPhone, String empFavorites, boolean bSalesAccess, boolean bBrewingAccess, boolean bCellaringAccess, boolean bPackagingAccess, boolean bLabAccess, boolean bTaproomAccess, boolean bBrewingNot, boolean bCellaringNot, boolean bPackagingNot, boolean bSalesNot, boolean bPurchasingNot, boolean bARApproval, int acetaldehyde, int isoamyl, int diacetyl, int dms, int trans2, int infected) {
        this.empID = empID;
        this.empLastName = empLastName;
        this.empFirstName = empFirstName;
        this.userName = userName;
        this.userPass = userPass;
        this.empAxed = empAxed;
        this.bBrewingAccess = bBrewingAccess;
    }

    public Integer getEmpID() {
        return empID;
    }

    public void setEmpID(Integer empID) {
        this.empID = empID;
    }

    public String getEmpLastName() {
        return empLastName;
    }

    public void setEmpLastName(String empLastName) {
        this.empLastName = empLastName;
    }

    public String getEmpFirstName() {
        return empFirstName;
    }

    public void setEmpFirstName(String empFirstName) {
        this.empFirstName = empFirstName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPass() {
        return userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    public boolean getEmpAxed() {
        return empAxed;
    }

    public void setEmpAxed(boolean empAxed) {
        this.empAxed = empAxed;
    }

    public boolean getBBrewingAccess() {
        return bBrewingAccess;
    }

    public void setBBrewingAccess(boolean bBrewingAccess) {
        this.bBrewingAccess = bBrewingAccess;
    }

    @XmlTransient
    public TimeCard getCard() {
        return card;
    }

    public void setCard(TimeCard card) {
        this.card = card;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (empID != null ? empID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmployeeView)) {
            return false;
        }
        EmployeeView other = (EmployeeView) object;
        if ((this.empID == null && other.empID != null) || (this.empID != null && !this.empID.equals(other.empID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.EmployeeView[ empID=" + empID + " ]";
    }
}
